using System;
using Patterns.Interfaces;

namespace Patterns.Aggregation
{
    public class AggregateFactory
    {
        public IAggregator<TAccumulate, TTerminate> NewAggregator<TAccumulate, TTerminate>(
            TAccumulate initValue,
            Func<TAccumulate, TAccumulate, TAccumulate> aggrAction,
            Func<TAccumulate, TAccumulate, TAccumulate> desaggrAction)
            where TAccumulate : struct
            where TTerminate : struct 
        {
            return new GenericAgregator<TAccumulate, TTerminate>(initValue, aggrAction, desaggrAction);
        }
    }
}